<template lang="html">
    <div class="table">
        <div class="crumbs">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item><i class="icon iconfont icon-jifen"></i> 发布详情</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="container">
            <el-form ref="form" :model="data" label-width="150px" @submit.native.prevent>
                <el-form-item label="公司名称" v-if="type==1">
                   <span>{{datacompany_name}}</span>
                </el-form-item>
                <el-form-item label="设备名称" v-if="type==2">
                   <span>{{datacompany_name}}</span>
                </el-form-item>
                <el-form-item label="封面图" v-if="type!=3">
                   <span><img :src="data.goodsInfo.head_img" style="width:360px;height:180px;"></span>
                </el-form-item>
                 <el-form-item label="详情图" v-if="type!=3">
                   <span v-for="item in imgList"><img :src="item" style="width:360px;height:180px;"></span>
                </el-form-item>
                <el-form-item label="公司规模">
                   <span>{{data.person_scale}}</span>
                </el-form-item>
                <el-form-item label="主营业务">
                   <span>{{data.main_business}}</span>
                </el-form-item>
                  <el-form-item label="主营业务">
                   <span>{{data.main_business}}</span>
                </el-form-item>
                <el-form-item label="收货地址">
                   <span>{{data.addressInfo.province}}{{data.addressInfo.city}}{{data.addressInfo.district}}{{data.addressInfo.address}}</span>
                </el-form-item>
                <el-form-item label="联系电话">
                   <span>{{data.addressInfo.mobile}}</span>
                </el-form-item>
                <el-form-item label="订单金额">
                   <span>{{data.pay_money}} 元</span>
                </el-form-item>
                <el-form-item label="下单时间">
                   <span>{{data.create_time}}</span>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="goBack()">返回</el-button>
                </el-form-item>
            </el-form>
        </div>
    </div>
</template>

<script>
import {postdataList,getdataDetails,getExpressList,getExpressInfo,postSendGoods} from '@/api/data'
    export default {
        data() {
            return {
                data: {},
                id:'',//订单id
                imgList:[],//产品详情图
                type:'',//类型 发布分类：1印厂,2设备,3招聘,4供应,5求购,6心情
            }
        },
        created() {
            //获得id
            if(this.$route.query.id &&this.$route.query.id!=""){
                this.id = this.$route.query.id;
                console.log(this.id)
            }else{
                this.$notify.error({
                        title: '错误',
                        message: '获取目标id失败，请返回列表页重试！'
                });
            }
            //获得type
            if(this.$route.query.type &&this.$route.query.type!=""){
                this.type = this.$route.query.id;
                console.log(this.type)
            }
            this.getDate();
        },
        methods: {
            //获取数据
            getDate(){
                getpubCheckList('',this.type,'','',1,99999999).then((response)=> {
                    console.log(response);
                    if(response.code==200){
                        var data = response.data;//当前返回的数据
                        //遍历数据取详情
                        for(let i=0;i<data.length;i++){
                            if(data[i].id == this.id){//找到了
                                this.data = data[i];
                            }
                        }
                    }else{
                        this.$notify.error({
                            title: '异常',
                            offset: 100,
                            message: response.msg
                        });
                    }
                })
            },
            //返回
            goBack(){
                this.$router.push('/check/publish/list')
            }
        }
    }
</script>

<style lang="stylus" scoped>
    .el-form-item .el-cascader {
        width: 400px;
    }

    .el-cascader-menus .el-cascader-menu {
        width: 240px
    }

    .sola-upload {

    .sola-left {
        width: 100%;
        height: auto;

    .sola-flex {
        float: left
        width: 360px;
        height: 180px;
        margin-bottom 20px;
        margin-right: 15px;
        position: relative;

    .delete {
        position: absolute;
        top: 2px;
        right: 13px;
        color: #f56c6c;
        display: inline-block;
        padding: 5px 5px;

    .el-alert__icon {
        font-size: 28px;
        cursor: pointer
    }

    }
    img {
        width: 100%;
        height: 100%;
    }

    }
    }
    .sola-file-box {
        position: relative;

    .btn-file {
        position: absolute;
        top: 0;
        left: 0;
        z-index 1;
        opacity: 0;
        width: 120px;
        height: 40px;
        outline: 0;
        background-color: none;
        cursor: pointer;
    }

    }

    }
</style>
